package xyz.zhouzhaodong.crm.controller;


import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import xyz.zhouzhaodong.crm.dto.ContractDto;
import xyz.zhouzhaodong.crm.service.IContractService;
import xyz.zhouzhaodong.crm.util.NoRepeatSubmit;
import xyz.zhouzhaodong.crm.util.RestMessage;

import javax.annotation.Resource;

/**
 * <p>
 * 合同 前端控制器
 * </p>
 *
 * @author zhouzhaodong
 * @since 2020-06-18
 */
@RestController
@RequestMapping("/contract")
public class ContractController {

    @Resource
    IContractService contractService;

    /**
     * 新增合同
     * @param contractDto
     * @return
     */
    @NoRepeatSubmit
    @RequestMapping("/add")
    public RestMessage addContract(ContractDto contractDto){
        return contractService.addContract(contractDto);
    }

    /**
     * 删除合同
     * @param contractDto
     * @return
     */
    @RequestMapping("/delete")
    public RestMessage deleteContract(ContractDto contractDto){
        return contractService.deleteContract(contractDto);
    }

    /**
     * 修改合同
     * @param contractDto
     * @return
     */
    @RequestMapping("/update")
    public RestMessage updateContract(ContractDto contractDto){
        return contractService.updateContract(contractDto);
    }

    /**
     * 查询合同
     * @param contractDto
     * @return
     */
    @RequestMapping("/select")
    public RestMessage selectContract(ContractDto contractDto){
        return contractService.selectContract(contractDto);
    }

    /**
     * 根据用户id查询合同信息
     * @param contractDto
     * @return
     */
    @RequestMapping("/selectList")
    public RestMessage selectContractList(ContractDto contractDto){
        return contractService.selectContractList(contractDto);
    }

}
